//
//  VisitorViewController.swift
//  weiboLQ
//
//  Created by 半缘君 on 15/12/6.
//  Copyright © 2015年 banyuanjun.cn. All rights reserved.
//

import UIKit

class VisitorViewController: UITableViewController {

    var isLogin = UserAccountViewModel.shareAccountModel.isLogin //false
    
    var visView: visitorView?
    
    override func loadView() {
        
        isLogin ? super.loadView():setupVisitorView()
        
    }
    
    func setupVisitorView (){
        
        visView = visitorView()
        visView?.registerbtn .addTarget(self, action: "registerBtnClick", forControlEvents: UIControlEvents.TouchUpInside)
        visView?.loginBtn.addTarget(self, action: "loginBtnClick", forControlEvents: UIControlEvents.TouchUpInside)
        view = visView
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "registerBtnClick")
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登陆", style: UIBarButtonItemStyle.Plain, target: self
            , action: "loginBtnClick")
        
        
    }
    
//    func setUpInfo(imageName:String,){
//        
//    }
    
}

extension VisitorViewController{
    func registerBtnClick () {
        print("注册")
        
    }
    func loginBtnClick () {
        let vc = OAuthViewController()
        
        let nav = UINavigationController(rootViewController: vc)
        
        presentViewController(nav, animated: true, completion: nil)
        
    }
}
